using System;
using System.Collections.Generic;
using CMS.Core.DataInterfaces;
using CMS.Core.Domain;

namespace CMS.Data
{
    public class NhomNguoiSuDungDao : AbstractNHibernateDao<NhomNguoiSuDung, System.Int32>, INhomNguoiSuDungDao
    {
        #region Create Instance
        private static NhomNguoiSuDungDao instance = null;
        public static NhomNguoiSuDungDao Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new NhomNguoiSuDungDao();
                }
                return instance;
            }
        }
        #endregion

        #region INhomNguoiSuDungDao Members

        public List<NhomNguoiSuDung> GetNhomNguoiSuDungHaveInitNSD()
        {
            try
            {
                List<NhomNguoiSuDung> Result = NhomNguoiSuDungDao.Instance.GetAll();
                    foreach (NhomNguoiSuDung nnsd in Result)
                    {
                        NHibernate.NHibernateUtil.Initialize(nnsd.NguoiSuDungs);
                    }
                return Result;
            }
            catch
            {
                return new List<NhomNguoiSuDung>();
            }
        }

        #endregion
    }
}
